super_errors: round two of error fixture coverage#8432
Conversation
…nvalid_for_loop_index, Field_access_on_dict_type, Private_label
…, Constraint_failed
…e_module_require_explicit_type
…recmodule Circular_dependency
…ld, Value_descriptions, Type_declarations)
…tension_constructor_payload, Inlined_record_expected
…_extend_private_type
…und_label, Unbound_modtype
… and With_mismatch
…ng_type, Invalid_bs_unwrap_type
…emod Module_types, Extension_constructors
…_mismatch, typedecl Inconsistent_constraint
…r_signature, typedecl Bad_variance
…ctor_arity_mismatch in pattern context
…on-abstract type
…, Expect_opt_in_bs_return_to_opt, Illegal_attribute
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8432 +/- ##
==========================================
+ Coverage 59.10% 59.92% +0.82%
==========================================
Files 373 373
Lines 54210 54210
==========================================
+ Hits 32040 32487 +447
+ Misses 22170 21723 -447 🚀 New features to boost your workflow:
|
|
Nice work! The "Dead in modern ReScript (parser / compiler can't produce the AST shape)" part of the PR description is interesting! Sounds like good opportunities for cleanup. Could you create a follow-up issue for that? |
cknitt
left a comment
There was a problem hiding this comment.
There are quite a few error messages that could be improved. I tagged some of them. Not in scope for this PR though.
| 4 [2m│[0m | ||
|
|
||
| This can't be called, it's not a function. | ||
| The function has type: int No newline at end of file |
There was a problem hiding this comment.
The last message sounds a bit strange actually.
Can be improved in a separate PR.
There was a problem hiding this comment.
Totally agree, actually once we have full error coverage I want to do an audit of all messages and aim for improvements. For the purposes of these coverage PRs its just supposed to assert how things are right now.
| 3 [2m│[0m | ||
| 4 [2m│[0m let _ = f("x") | ||
|
|
||
| %@return directive *_to_opt expect return type to be |
| 2 [2m│[0m | ||
| 3 [2m│[0m let _ = f(#A) | ||
|
|
||
| expect int literal No newline at end of file |
| 2 [2m│[0m | ||
| 3 [2m│[0m let _ = f(#A) | ||
|
|
||
| conflicting attributes No newline at end of file |
Also agree, as the agent is working through these and finding dead paths I'm collecting them in a file so that it can be documented in these PR descriptions. I think a follow up to these coverage PRs will be to go through the documented dead paths and try remove code. |
super_errors: round two of error fixture coverage
Builds on #8429 (jono/expand-coverage). Same playbook — one
.resfile pererror variant — applied to the variants that branch missed.
~75 new single-file fixtures across 33 commits, covering every reachable
single-file error variant in
typecore,typedecl,typemod,typetexp,includemod,translcore,translmod,transl_recmodule,rec_check, andbs_syntaxerr.After this round, what remains either requires multi-file setups (separate
follow-up) or is dead code in the current parser / compiler. Both lists are
written down below so reviewers don't have to re-derive them.
Coverage impact
Measured locally with
make coverage(bisect_ppx point coverage). Baseline isupstream/master after #8429 was merged.
Per-file moves on the modules this branch targets:
compiler/ml/transl_recmodule.mlcompiler/frontend/bs_syntaxerr.mlcompiler/ml/typemod.mlcompiler/ml/rec_check.mlcompiler/ml/typetexp.mlcompiler/ml/typedecl.mlcompiler/ml/includemod.mlcompiler/frontend/ast_attributes.mlcompiler/ml/translmod.mlcompiler/frontend/ast_external_process.mlcompiler/ml/typecore.mlcompiler/ml/translcore.mlWhat's covered
typecore — Label_not_mutable, Apply_non_function, Invalid_for_loop_index,
Field_access_on_dict_type, Private_label, Not_an_extension_constructor,
Invalid_extension_constructor_payload, Inlined_record_expected, Less_general,
Constructor_arity_mismatch (expression + pattern), Private_type construction,
let-module scope escape, Cannot_infer_signature, Undefined_method.
typedecl — Boxed_and_unboxed, Bad_unboxed_attribute (abstract, mutable,
many-fields, extensible), Constraint_failed, Nonrec_gadt, Not_extensible_type,
Cannot_extend_private_type, Object_spread_with_record_field,
Inconsistent_constraint, Bad_immediate_attribute, Unbound_type_var_ext,
Bad_variance (covariant + contravariant), Definition_mismatch,
Invalid_attribute (@notundefined on non-abstract), Variant_spread_fail
(non-variant source).
typemod — With_no_component, Cannot_apply,
Recursive_module_require_explicit_type, Apply_generative, With_mismatch,
Structure_expected (opening a functor), Not_a_packed_module,
Not_allowed_in_functor_body, Incomplete_packed_module, Non_generalizable.
typetexp — Unbound_value, Unbound_constructor, Unbound_label,
Unbound_modtype, Multiple_constraints_on_type, Method_mismatch,
Access_functor_as_structure, Constructor_mismatch, Not_an_object,
Opened_object, Alias_type_mismatch.
includemod — Missing_field, Value_descriptions, Type_declarations,
Module_types, Extension_constructors, Modtype_infos, Modtype_permutation.
bs_syntaxerr — Invalid_bs_int_type, Invalid_bs_string_type,
Invalid_bs_unwrap_type, Conflict_attributes, Expect_string_literal,
Expect_int_literal, Not_supported_directive_in_bs_return,
Expect_opt_in_bs_return_to_opt, Illegal_attribute.
translcore — Unknown_builtin_primitive.
translmod — Fragile_pattern_in_toplevel.
transl_recmodule — Circular_dependency.
rec_check — Illegal_letrec_expr.
Dead in modern ReScript (parser / compiler can't produce the AST shape)
Invalid_for_of_pattern— parser pre-normalizes the pattern.Polymorphic_label(typecore) — record set / match paths now succeed.Parameters_differ— variant declarations with non-uniform recursion areaccepted; abbreviations hit
Cycle_in_deffirst.Apply_structure_as_functor,Ill_typed_functor_application,Cannot_eliminate_dependency—M(N).ttype-level syntax doesn't exist,and module-level functor applications always resolve concretely.
Misplaced_label_syntax— only fires for labeled args to->/#=/##,but the parser always emits those as
Nolabel.Variant_tags— theTagsexception is defined inctype.mlbut neverraised; the path is effectively dead.
Unhandled_poly_type— parser rejects inline poly types in arrow chains.Unqualified_gadt_pattern— masked byUnbound_constructorin everynatural reproduction.
Name_type_mismatch— every reproduction lands onWrong_namefirst.Val_in_structure— requirespval_prim = [], which the parser neverproduces.
Bad_fixed_type,Unbound_type_constructor_2— behind#rowprivate-rowsyntax that isn't exposed.
Invalid_underscore_type_in_external— needs?label:_in@@objexternals; the standalone form is fine.
Cannot_quantify(typetexp) — every value-level reproduction lands onLess_generalfirst; type-level Ptyp_poly always quantifies cleanly.Recursive_local_constraint— GADT pattern that would producea cyclic local abbreviation doesn't surface this error in ReScript's
matcher.
Bs_this_simple_pattern,Optional_in_uncurried_bs_attribute,Conflict_bs_bs_this_bs_meth—@thisdoesn't parse on regular functions.Expect_int_or_string_or_json_literal— needs an@as(...)with adelimited string that isn't a valid JS literal; plain string / int /
identifier payloads all succeed.
Unsupported_predicates—@get/@setreject unknown payload shapesearlier with the generic "Invalid payload" message.
Illegal_reference_to_recursive_module— theEnv.Recmoduleexceptionisn't reachable from a single-file recmodule (the placeholder is sealed
before the type lookup runs).
With_cannot_remove_constrained_type,With_changes_module_alias,With_makes_applicative_functor_ill_typed— nichewith typepaths thatdon't fire from any single-file
with type X := ...construction I tried.ast_utf8_stringfamily (Invalid_hex_escape, Invalid_unicode_escape,Invalid_unicode_codepoint_escape, Invalid_code_point,
Unterminated_backslash) — only reachable via the legacy
{j|…|j}delimiter; backquote template strings skip the transform.
Reachable only with multi-file setups
These are real, user-facing errors but can't be triggered from one
.res:typetexp.Cannot_scrape_alias,typemod.Cannot_scrape_alias— need abroken alias chain that crosses module boundaries.
typedecl.Unavailable_type_constructor— needs a type path thatdisappears, which happens across compilation units.
typemod.Interface_not_compiled— missing.cmi, by definitionmulti-unit.
typemod.Scoping_pack,typemod.Non_generalizable_module— requiremodule sealing where types from different scopes meet.
includemod.Interface_mismatch,includemod.Invalid_module_alias,includemod.Unbound_modtype_path,includemod.Unbound_module_path— allfire only across module / file boundaries.
These motivate the multi-file harness follow-up — same playbook (one fixture
per error variant) but compiling a directory tree per fixture instead of one
file.
Closing claim
This is now exhaustive for single-file
super_errorsfixtures. Everyremaining error variant in the modules above either has a fixture, has a
written-down reason it can't be triggered from one file, or is dead code.